package effective_java.design_pattern.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Verlet
 * @date 2023-09-30 17:50
 */
public class Waitor {
    private List<Command> commandList;

    public Waitor() {
        this.commandList = new ArrayList<>();
    }

    public void addCommand(Command command) {
        this.commandList.add(command);
    }

    /**
     * 发出命令 喊 订单来了，厨师开始处理
     */
    public void orderUp(){
        System.out.println("美女服务员：叮咚，大厨，新订单来了.......");
        for (Command command : commandList){
            command.execute();
        }
    }
}
